<?php defined('SYS_PATH') or die('No direct script access.');
/**
 * My View
 */
class View extends TrueBlood_View
{
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->setDefaults();
    }

    /**
     * Assign default variables to the view
     * 
     * @return void
     */
    private function setDefaults()
    {
        $metas = array
        (
            'title'         => '', 
            'keywords'      => '', 
            'description'   => ''
        );
        $this->metas($metas);
        $this->scripts(array('script.js'));
        $this->styles(array('style.css'));
    }

    /**
     * Set metas
     * 
     * @param mixed $metas
     * @param mixed $value
     * @return void
     */
    public function metas($metas, $value = null)
    {
        if (!is_array($metas))
        {
            $metas = array($metas => $value);
        }
        $metas = array_merge($metas + (array)$this->page_metas);
        $this->assign('page_metas', $metas);
    }

    /**
     * Add javascript files
     *
     * @param mixed $scripts
     * @return void
     */
    public function scripts($scripts = array())
    {
        if (!is_array($scripts))
        {
            $scripts = array($scripts);
        }
        $scripts = array_unique($scripts + (array)$this->page_scripts);
        $this->assign('page_scripts', $scripts);
    }

    /**
     * Add CSS files
     *
     * @param mixed $styles
     * @return void
     */
    public function styles($styles = array())
    {
        if (!is_array($styles))
        {
            $styles = array($styles);
        }
        $styles = array_unique($styles + (array)$this->page_styles);
        $this->assign('page_styles', $styles);
    }
}

?>